import CanvasApi from "@/api/canvasApi";

export function useGetCondition(id: any) {
  const Store = useStore();


  // 获取活动数据
  const getActivity = async()=> {
    
    let params = {
      name: "",
      status: 1,
      currentPage: 1,
      showCount: -1,
    };
    let actList = {
      1: [],
      2: [],
    } as any
    let rs = await CanvasApi.getActivityList(params);
    if (rs.code === 200) {
      
      rs.payload.forEach((el: { type: number; id: any; name: any; }) => {
        if (el.type == 1) {
          actList[1].push({
            value: el.id,
            label: el.name,
          })
        } else {
          actList[2].push({
            value: el.id,
            label: el.name,
          })
        }
      });

      Store.commit("event/setEventActivity", actList);
    }
  }

  return {
    getActivity
  }
}
